package com.iplant.wms.service.po.batch;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.po.DBBasePO;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.join.DBJoin;
import com.iplant.base.utils.general.CalendarTool;

import java.io.Serializable;
import java.util.Calendar;

/**
 * 批次记录   Code作为批次编码 全局唯一
 */
@DBBasePO(TableName = "mss_batchrecord", CheckName = {"Code",
        "FactoryID,RuleCode,CustomerID,MaterialID,ProductDate,ExpireDate,StockDate"},
        Schemas = DBSchemas.WMS, Name = false, CodeAuto = true, CodePrefix = "{:MaterialNo}{yyMMdd}", CodeNum = 4)
public class MSSBatchRecord extends BasePO implements Serializable {
    private static final long serialVersionUID = 1L;


    @DBCondition
    @DBField(Update = false)
    public int FactoryID = 0;

    @DBJoin(name = "Code", tableName = "fmc_factory", tableAsName = "f1",
            Schemas = DBSchemas.Basic, MainTableField = "FactoryID")
    public String FactoryCode = "";

    @DBJoin(name = "Name", tableName = "fmc_factory", tableAsName = "f1",
            Schemas = DBSchemas.Basic, MainTableField = "FactoryID")
    public String FactoryName = "";


    /**
     * 生产日期  01
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.geLe,
            ParamName = "ProductStartDate", ParamName2 = "ProductEndDate")
    @DBField
    public Calendar ProductDate = CalendarTool.getDate(Calendar.getInstance());
    /**
     * 失效日期  02
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.geLe,
            ParamName = "ProductStartDate", ParamName2 = "ProductEndDate")
    @DBField
    public Calendar ExpireDate = CalendarTool.getDate(Calendar.getInstance());

    /**
     * 入库日期  03
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.geLe,
            ParamName = "ProductStartDate", ParamName2 = "ProductEndDate")
    @DBField
    public Calendar StockDate = CalendarTool.getDate(Calendar.getInstance());

    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBField
    public String LotAttr04 = "";
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBField
    public String LotAttr05 = "";
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBField
    public String LotAttr06 = "";
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBField
    public String LotAttr07 = "";
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBField
    public String LotAttr08 = "";
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBField
    public String LotAttr09 = "";
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBField
    public String LotAttr10 = "";
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBField
    public String LotAttr11 = "";
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBField
    public String LotAttr12 = "";


    /**
     * 规则
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBField(Update = false)
    public String RuleCode = "";
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBField

    public String RuleName = "";
    /**
     * 客户  供应商
     */
    @DBCondition
    @DBField(Update = false)
    public int CustomerID = 0;

    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBField(Update = false)
    public String CustomerCode = "";

    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBField(Update = false)
    public String CustomerName = "";


    @DBCondition
    @DBField(Update = false, CheckValue = true)
    public int MaterialID = 0;
    /**
     * 物料
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBField(Update = false, CheckValue = true)
    public String MaterialNo = "";

    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Name", tableName = "mss_material", tableAsName = "mss_material1", Schemas = DBSchemas.Basic,
            MainTableField = "MaterialID")
    public String MaterialName = "";


    public MSSBatchRecord() {
    }


    @JsonProperty("ProductDate")
    public Calendar getProductDate() {
        return ProductDate;
    }

    public void setProductDate(Calendar productDate) {
        ProductDate = productDate;
    }

    @JsonProperty("ExpireDate")
    public Calendar getExpireDate() {
        return ExpireDate;
    }

    public void setExpireDate(Calendar expireDate) {
        ExpireDate = expireDate;
    }

    @JsonProperty("StockDate")
    public Calendar getStockDate() {
        return StockDate;
    }

    public void setStockDate(Calendar stockDate) {
        StockDate = stockDate;
    }

    @JsonProperty("LotAttr04")
    public String getLotAttr04() {
        return LotAttr04;
    }

    public void setLotAttr04(String lotAttr04) {
        LotAttr04 = lotAttr04;
    }

    @JsonProperty("LotAttr05")
    public String getLotAttr05() {
        return LotAttr05;
    }

    public void setLotAttr05(String lotAttr05) {
        LotAttr05 = lotAttr05;
    }

    @JsonProperty("LotAttr06")
    public String getLotAttr06() {
        return LotAttr06;
    }

    public void setLotAttr06(String lotAttr06) {
        LotAttr06 = lotAttr06;
    }

    @JsonProperty("LotAttr07")
    public String getLotAttr07() {
        return LotAttr07;
    }

    public void setLotAttr07(String lotAttr07) {
        LotAttr07 = lotAttr07;
    }

    @JsonProperty("LotAttr08")
    public String getLotAttr08() {
        return LotAttr08;
    }

    public void setLotAttr08(String lotAttr08) {
        LotAttr08 = lotAttr08;
    }

    @JsonProperty("LotAttr09")
    public String getLotAttr09() {
        return LotAttr09;
    }

    public void setLotAttr09(String lotAttr09) {
        LotAttr09 = lotAttr09;
    }

    @JsonProperty("LotAttr10")
    public String getLotAttr10() {
        return LotAttr10;
    }

    public void setLotAttr10(String lotAttr10) {
        LotAttr10 = lotAttr10;
    }

    @JsonProperty("LotAttr11")
    public String getLotAttr11() {
        return LotAttr11;
    }

    public void setLotAttr11(String lotAttr11) {
        LotAttr11 = lotAttr11;
    }

    @JsonProperty("LotAttr12")
    public String getLotAttr12() {
        return LotAttr12;
    }

    public void setLotAttr12(String lotAttr12) {
        LotAttr12 = lotAttr12;
    }


    @JsonProperty("RuleCode")
    public String getRuleCode() {
        return RuleCode;
    }

    public void setRuleCode(String ruleCode) {
        RuleCode = ruleCode;
    }

    @JsonProperty("RuleName")
    public String getRuleName() {
        return RuleName;
    }

    public void setRuleName(String ruleName) {
        RuleName = ruleName;
    }

    @JsonProperty("CustomerID")
    public int getCustomerID() {
        return CustomerID;
    }

    public void setCustomerID(int customerID) {
        CustomerID = customerID;
    }

    @JsonProperty("CustomerCode")
    public String getCustomerCode() {
        return CustomerCode;
    }

    public void setCustomerCode(String customerCode) {
        CustomerCode = customerCode;
    }

    @JsonProperty("CustomerName")
    public String getCustomerName() {
        return CustomerName;
    }

    public void setCustomerName(String customerName) {
        CustomerName = customerName;
    }


    @JsonProperty("MaterialNo")
    public String getMaterialNo() {
        return MaterialNo;
    }

    public void setMaterialNo(String materialNo) {
        MaterialNo = materialNo;
    }

    @JsonProperty("MaterialName")
    public String getMaterialName() {
        return MaterialName;
    }

    public void setMaterialName(String materialName) {
        MaterialName = materialName;
    }
}
